package com.cloudsigns.factorymanager2.engineering.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.cusenum.CommonEnum;
import com.cloudsigns.factorymanager2.engineering.IView.IPatrolFeedBackView;
import com.cloudsigns.factorymanager2.engineering.IView.IUploadPhotoView;
import com.cloudsigns.factorymanager2.engineering.adapter.GridAdapter;
import com.cloudsigns.factorymanager2.engineering.adapter.WattingToReceiveEngineeringOrderAdapter;
import com.cloudsigns.factorymanager2.engineering.bean.DialogItemBean;
import com.cloudsigns.factorymanager2.engineering.bean.MediaBean;
import com.cloudsigns.factorymanager2.engineering.bean.OrderParentBean;
import com.cloudsigns.factorymanager2.engineering.bean.PatrolFeedbackBean;
import com.cloudsigns.factorymanager2.engineering.bean.PatrolOrderBean;
import com.cloudsigns.factorymanager2.engineering.customview.BottomDialog;
import com.cloudsigns.factorymanager2.engineering.customview.BottomListDialog;
import com.cloudsigns.factorymanager2.engineering.presenter.PatrolFeedBackPresenter;
import com.cloudsigns.factorymanager2.engineering.presenter.UploadPhotoPresenter;
import com.cloudsigns.factorymanager2.engineering.utils.PhotoUtil;
import com.cloudsigns.factorymanager2.event.EngineeringOrderDetailForTeamEvent;
import com.cloudsigns.factorymanager2.project.activity.AddEngineeringInstallationOrderActivity;
import com.cloudsigns.factorymanager2.project.bean.ProductBean;
import com.cloudsigns.factorymanager2.project.utils.ConstantUtil;
import com.cloudsigns.factorymanager2.project.utils.FileUtil;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import de.greenrobot.event.EventBus;

/**
 * Created by tony on 2018/5/27.
 */

public class FeedBackForPatrolActivity extends Activity implements View.OnClickListener, AdapterView.OnItemClickListener
        , BottomListDialog.OnItemDialogClick, CompoundButton.OnCheckedChangeListener, RadioGroup.OnCheckedChangeListener, IPatrolFeedBackView, IUploadPhotoView {
    private RelativeLayout rl_back;
    private TextView tv_project_name, tv_engineering_name;
    private TextView tv_title;
    private CheckBox cb_waibuqingjie, cb_neibuqingjie, cb_jiexianduanzi, cb_jinguchajian, cb_xiangtijizuo, cb_guangyuandianyuan;
    private EditText edt_biaomianzhaodu, edt_xianlan, edt_zongdianliu, edt_guangyuan, edt_kaiguan, edt_duanzi, edt_gdianyuan, edt_biaomianwendu, edt_zongdianya;
    private RadioGroup rg_shengjiangxitong, rg_zhutijiegou, rg_waiguan, rg_huamian, rg_gangsuohualun, rg_anquankousuo, rg_shiyong_huanjing, rg_fangshui_huanjing;
    private TextView btn_submit;
    private List<String> environmentImgUrlList = new ArrayList<>();
    private CommonEnum.LIFTSYSTEM liftSystem;
    private List<String> majorImgUrlList = new ArrayList<>();
    private CommonEnum.LIFTSYSTEM majorStructure;
    private CommonEnum.LIFTSYSTEM outline;
    private List<CommonEnum.PRESERVELIST> preserveList = new ArrayList<>();
    private CommonEnum.LIFTSYSTEM pulley;
    private CommonEnum.LIFTSYSTEM safeLock;
    private CommonEnum.LIFTSYSTEM useEnvironment;
    private CommonEnum.LIFTSYSTEM waterProofEnvironment;
     private CommonEnum.LIFTSYSTEM picture;

    private GridView gridView_enviroment, gridView_major;
    private GridAdapter gridAdapter_enviroment, gridAdapter_majo;
    private List<String> enviromentPathList = new ArrayList<>();
    private List<String> majorPathList = new ArrayList<>();
    private final int GRIDVIEW_MODULE_MAJOR = 0;
    private final int GRIDVIEW_MODULE_ENVIROMENT = 1;
    private int current_gridvew_module = -1;
    private String filePath;

    private PatrolOrderBean patrolOrderBean;
    private MediaBean mediaBean;
    private PatrolFeedBackPresenter patrolFeedBackPresenter;
    private UploadPhotoPresenter uploadPhotoPresenter;
    private PatrolFeedbackBean patrolFeedbackBean;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
        // 沉浸式状态栏
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                    );
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);

        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        setContentView(R.layout.layout_patrol_feed_back);

        patrolFeedBackPresenter = new PatrolFeedBackPresenter(this);
        uploadPhotoPresenter = new UploadPhotoPresenter(this);
        init();

        tv_title.setText("巡查反馈");

        if (null != getIntent()) {
            patrolOrderBean = (PatrolOrderBean) getIntent().getSerializableExtra(ConstantUtil.KEY_1);
            mediaBean = (MediaBean) getIntent().getSerializableExtra(ConstantUtil.KEY_2);
        }

        if (null != mediaBean) {
            tv_project_name.setText(mediaBean.getMediaName());
            tv_engineering_name.setText(mediaBean.getNumber());
        }



    }

    private void init() {
        rl_back = findViewById(R.id.rl_back);
        tv_title = findViewById(R.id.tv_title);

        tv_project_name = findViewById(R.id.tv_project_name);
        tv_engineering_name = findViewById(R.id.tv_engineering_name);

        cb_waibuqingjie = findViewById(R.id.cb_waibuqingjie);
        cb_neibuqingjie = findViewById(R.id.cb_neibuqingjie);
        cb_jiexianduanzi = findViewById(R.id.cb_jiexianduanzi);

        cb_jinguchajian = findViewById(R.id.cb_jinguchajian);
        cb_xiangtijizuo = findViewById(R.id.cb_xiangtijizuo);
        cb_guangyuandianyuan = findViewById(R.id.cb_guangyuandianyuan);

        cb_waibuqingjie.setOnCheckedChangeListener(this);
        cb_neibuqingjie.setOnCheckedChangeListener(this);
        cb_jiexianduanzi.setOnCheckedChangeListener(this);

        cb_jinguchajian.setOnCheckedChangeListener(this);
        cb_xiangtijizuo.setOnCheckedChangeListener(this);
        cb_guangyuandianyuan.setOnCheckedChangeListener(this);


        edt_biaomianzhaodu = findViewById(R.id.edt_biaomianzhaodu);
        edt_xianlan = findViewById(R.id.edt_xianlan);
        edt_zongdianliu = findViewById(R.id.edt_zongdianliu);
        edt_guangyuan = findViewById(R.id.edt_guangyuan);
        edt_kaiguan = findViewById(R.id.edt_kaiguan);
        edt_duanzi = findViewById(R.id.edt_duanzi);
        edt_gdianyuan = findViewById(R.id.edt_gdianyuan);
        edt_biaomianwendu = findViewById(R.id.edt_biaomianwendu);
        edt_zongdianya = findViewById(R.id.edt_zongdianya);

        rg_shengjiangxitong = findViewById(R.id.rg_shengjiangxitong);
        rg_zhutijiegou = findViewById(R.id.rg_zhutijiegou);
        rg_waiguan = findViewById(R.id.rg_waiguan);

        rg_huamian = findViewById(R.id.rg_huamian);
        rg_gangsuohualun = findViewById(R.id.rg_gangsuohualun);
        rg_anquankousuo = findViewById(R.id.rg_anquankousuo);

        rg_shiyong_huanjing = findViewById(R.id.rg_shiyong_huanjing);
        rg_fangshui_huanjing = findViewById(R.id.rg_fangshui_huanjing);


        enviromentPathList.add("paizhao");
        majorPathList.add("paizhao");

        gridView_enviroment = findViewById(R.id.gridView_enviroment);
        gridView_enviroment.setNumColumns(3);
        gridAdapter_enviroment = new GridAdapter(this);
        gridAdapter_enviroment.setData(enviromentPathList);
        gridView_enviroment.setAdapter(gridAdapter_enviroment);
        gridView_enviroment.setOnItemClickListener(this);

        gridView_major = findViewById(R.id.gridView_major);
        gridView_major.setNumColumns(3);
        gridAdapter_majo = new GridAdapter(this);
        gridAdapter_majo.setData(majorPathList);
        gridView_major.setAdapter(gridAdapter_majo);
        gridView_major.setOnItemClickListener(this);


        rg_shengjiangxitong.setOnCheckedChangeListener(this);
        rg_zhutijiegou.setOnCheckedChangeListener(this);
        rg_waiguan.setOnCheckedChangeListener(this);

        rg_huamian.setOnCheckedChangeListener(this);
        rg_gangsuohualun.setOnCheckedChangeListener(this);
        rg_anquankousuo.setOnCheckedChangeListener(this);

        rg_shiyong_huanjing.setOnCheckedChangeListener(this);
        rg_fangshui_huanjing.setOnCheckedChangeListener(this);


        btn_submit = findViewById(R.id.btn_submit);

        rl_back.setOnClickListener(this);

        btn_submit.setOnClickListener(this);



    }

    private void submit() {
        if (null != patrolFeedBackPresenter)
            patrolFeedBackPresenter.patrolFeedBack();
    }

    private void showListDialog() {
        DialogItemBean[] items = new DialogItemBean[]{
                new DialogItemBean(R.string.camera,
                        R.layout.dialog_list_item_normal),
                new DialogItemBean(R.string.gallary,
                        R.layout.dialog_list_item_normal),
                new DialogItemBean(R.string.cancel,
                        R.layout.dialog_list_item_normal)};
        BottomListDialog dialog = new BottomListDialog(this, Arrays.asList(items));
        dialog.setItemClick(this);
        dialog.show();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rl_back:
                finish();
                break;
            case R.id.btn_submit:
                submit();
                break;
        }
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
        String imgs = (String) adapterView.getItemAtPosition(position);
        if ("paizhao".equals(imgs)) {
            showListDialog();
        }

        if (adapterView == gridView_enviroment) {
            current_gridvew_module = GRIDVIEW_MODULE_ENVIROMENT;
        } else if (adapterView == gridView_major) {
            current_gridvew_module = GRIDVIEW_MODULE_MAJOR;
        }
    }

    @Override
    public void onItemDialogClick(DialogItemBean item) {

        switch (item.getmTextId()) {
            case R.string.camera: {
                PhotoUtil.startCamear(FeedBackForPatrolActivity.this, null);
                break;
            }
            case R.string.gallary: {
                PhotoUtil.startGallery(FeedBackForPatrolActivity.this, null);
                break;
            }
            default:
                break;
        }
    }


    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
        if (b) {
            if (compoundButton == cb_waibuqingjie) {
                preserveList.add(CommonEnum.PRESERVELIST.OUT_CLEAN);
            } else if (compoundButton == cb_neibuqingjie) {
                preserveList.add(CommonEnum.PRESERVELIST.IN_CLEAN);
            } else if (compoundButton == cb_jiexianduanzi) {
                preserveList.add(CommonEnum.PRESERVELIST.CABLE_PORT);
            } else if (compoundButton == cb_jinguchajian) {
                preserveList.add(CommonEnum.PRESERVELIST.PLUG);
            } else if (compoundButton == cb_xiangtijizuo) {
                preserveList.add(CommonEnum.PRESERVELIST.BOX_BOLT);
            } else if (compoundButton == cb_guangyuandianyuan) {
                preserveList.add(CommonEnum.PRESERVELIST.LIGHT_POWER);
            }
        } else {
            if (compoundButton == cb_waibuqingjie) {
                if (preserveList.contains(CommonEnum.PRESERVELIST.OUT_CLEAN))
                    preserveList.remove(CommonEnum.PRESERVELIST.OUT_CLEAN);

            } else if (compoundButton == cb_neibuqingjie) {
                if (preserveList.contains(CommonEnum.PRESERVELIST.IN_CLEAN))
                    preserveList.remove(CommonEnum.PRESERVELIST.IN_CLEAN);

            } else if (compoundButton == cb_jiexianduanzi) {
                if (preserveList.contains(CommonEnum.PRESERVELIST.CABLE_PORT))
                    preserveList.remove(CommonEnum.PRESERVELIST.CABLE_PORT);

            } else if (compoundButton == cb_jinguchajian) {
                if (preserveList.contains(CommonEnum.PRESERVELIST.PLUG))
                    preserveList.remove(CommonEnum.PRESERVELIST.PLUG);

            } else if (compoundButton == cb_xiangtijizuo) {
                if (preserveList.contains(CommonEnum.PRESERVELIST.BOX_BOLT))
                    preserveList.remove(CommonEnum.PRESERVELIST.BOX_BOLT);

            } else if (compoundButton == cb_guangyuandianyuan) {
                if (preserveList.contains(CommonEnum.PRESERVELIST.LIGHT_POWER))
                    preserveList.remove(CommonEnum.PRESERVELIST.LIGHT_POWER);

            }
        }

    }


    @Override
    public void onCheckedChanged(RadioGroup radioGroup, @IdRes int id) {

        if (radioGroup == rg_shengjiangxitong) {
            if (id == R.id.rb_shengjiangxitong_ok)
                liftSystem = CommonEnum.LIFTSYSTEM.NORMAL;
            else if (id == R.id.rbshengjiangxitong_general)
                liftSystem = CommonEnum.LIFTSYSTEM.MALFUNCTION;
        } else if (radioGroup == rg_zhutijiegou) {
            if (id == R.id.rb_zhutijiegou_ok) {
                majorStructure = CommonEnum.LIFTSYSTEM.NORMAL;
            } else if (id == R.id.rb_zhutijiegou_xiu) {
                majorStructure = CommonEnum.LIFTSYSTEM.RUST;
            } else if (id == R.id.rb_zhutijiegou_bianxing) {
                majorStructure = CommonEnum.LIFTSYSTEM.VARIANT;
            } else if (id == R.id.rb_zhutijiegou_songdong) {
                majorStructure = CommonEnum.LIFTSYSTEM.LOOSE;
            }

        } else if (radioGroup == rg_waiguan) {
            if (id == R.id.rb_waiguan_ok) {
                outline = CommonEnum.LIFTSYSTEM.NORMAL;
            } else if (id == R.id.rb_waiguan_general) {
                outline = CommonEnum.LIFTSYSTEM.SCRATCH;
            } else if (id == R.id.rb_waiguan_bainxing) {
                outline = CommonEnum.LIFTSYSTEM.VARIANT;
            } else if (id == R.id.rb_waiguan_bujie) {
                outline = CommonEnum.LIFTSYSTEM.NOT_CLEAN;
            }

        } else if (radioGroup == rg_huamian) {
            if (id == R.id.rb_huamian_ok) {
                picture = CommonEnum.LIFTSYSTEM.NORMAL;
            } else if (id == R.id.rb_huamian_general) {
                picture = CommonEnum.LIFTSYSTEM.PLICATED;
            } else if (id == R.id.rb_huamian_silie) {
                picture = CommonEnum.LIFTSYSTEM.TEAR;
            } else if (id == R.id.rb_huamian_huashang) {
                picture = CommonEnum.LIFTSYSTEM.WEAR;
            }
        } else if (radioGroup == rg_gangsuohualun) {
            if (id == R.id.rb_gangsuohualun_ok) {
                pulley = CommonEnum.LIFTSYSTEM.NORMAL;
            } else if (id == R.id.rb_gangsuohualun_general) {
                pulley = CommonEnum.LIFTSYSTEM.SCRATCH;
            } else if (id == R.id.rbgangsuohualun_mosun) {
                pulley = CommonEnum.LIFTSYSTEM.MALFUNCTION;
            }

        } else if (radioGroup == rg_anquankousuo) {
            if (id == R.id.rb_anquankousuo_ok) {
                safeLock = CommonEnum.LIFTSYSTEM.NORMAL;
            } else if (id == R.id.rb_anquankousuo_general) {
                safeLock = CommonEnum.LIFTSYSTEM.MALFUNCTION;
            }

        } else if (radioGroup == rg_shiyong_huanjing) {
            if (id == R.id.rb_shiyong_huanjing_ok) {
                useEnvironment = CommonEnum.LIFTSYSTEM.NORMAL;
            } else if (id == R.id.rb_shiyong_huanjing_general) {
                useEnvironment = CommonEnum.LIFTSYSTEM.WEAR;
            }
        } else if (radioGroup == rg_fangshui_huanjing) {
            if (id == R.id.rb_fangshui_huanjing_ok) {
                waterProofEnvironment = CommonEnum.LIFTSYSTEM.NORMAL;
            } else if (id == R.id.rb_fangshui_huanjing_general) {
                waterProofEnvironment = CommonEnum.LIFTSYSTEM.WEAR;
            }
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {

            case PhotoUtil.CAMERA:
                if (resultCode == RESULT_OK) {
                    File picture = new File(PhotoUtil.filePath);
                    if (!picture.exists()) {
                        picture = new File(PhotoUtil.filePath);
                    }

                    filePath = PhotoUtil.CAMERA_SEVER + picture.getName();
                    filePath = PhotoUtil.imageCompressionAndSave(picture.getAbsolutePath(), filePath);
                    //override(100, 100)

                    if (current_gridvew_module == GRIDVIEW_MODULE_ENVIROMENT) {

                        if (enviromentPathList.contains("paizhao")) {
                            enviromentPathList.remove("paizhao");
                        }
                        if (enviromentPathList.size() < 3) {
                            enviromentPathList.add(filePath);
                            if (enviromentPathList.size() < 3)
                                enviromentPathList.add("paizhao");

                            gridAdapter_enviroment.setData(enviromentPathList);
                            gridAdapter_enviroment.notifyDataSetChanged();
                        }


                    } else if (current_gridvew_module == GRIDVIEW_MODULE_MAJOR) {
                        if (majorPathList.contains("paizhao")) {
                            majorPathList.remove("paizhao");
                        }
                        if (majorPathList.size() < 3) {
                            majorPathList.add(filePath);
                            if (majorPathList.size() < 3)
                                majorPathList.add("paizhao");

                            gridAdapter_majo.setData(majorPathList);
                            gridAdapter_majo.notifyDataSetChanged();
                        }

                    }

                    uploadPhotoPresenter.uploadPhtoto();
                }


                break;
            case PhotoUtil.GALLERY:
                if (resultCode == RESULT_OK) {

                    String path = FileUtil.getRealPathFromURI(this, Uri.parse(data.getData() + ""));

                    if (current_gridvew_module == GRIDVIEW_MODULE_ENVIROMENT) {
                        if (enviromentPathList.contains("paizhao")) {
                            enviromentPathList.remove("paizhao");
                        }

                        if (enviromentPathList.size() < 3) {

                            enviromentPathList.add(path);
                            if (enviromentPathList.size() < 3)
                                enviromentPathList.add("paizhao");
                            gridAdapter_enviroment.setData(enviromentPathList);
                            gridAdapter_enviroment.notifyDataSetChanged();
                        }
                    } else if (current_gridvew_module == GRIDVIEW_MODULE_MAJOR) {
                        if (majorPathList.contains("paizhao")) {
                            majorPathList.remove("paizhao");
                        }

                        if (majorPathList.size() < 3) {

                            majorPathList.add(path);
                            if (majorPathList.size() < 3)
                                majorPathList.add("paizhao");
                            gridAdapter_majo.setData(majorPathList);
                            gridAdapter_majo.notifyDataSetChanged();
                        }
                    }


                    File f = new File(path);
                    filePath = PhotoUtil.CAMERA_SEVER + f.getName();
                    filePath = PhotoUtil.imageCompressionAndSave(path, filePath);
//                    filePath = data.getData() + "";
                    uploadPhotoPresenter.uploadPhtoto();
//                    if (f.exists()) {
//                        f.delete();
//                    }

                }
                break;
        }
        super.onActivityResult(requestCode, resultCode, data);
    }


    @Override
    public PatrolFeedbackBean getPatrolFeedbackBean() {
        patrolFeedbackBean = new PatrolFeedbackBean();
        String bright = edt_biaomianzhaodu.getText().toString().trim();
        String cable = edt_xianlan.getText().toString().trim();
        String current = edt_zongdianliu.getText().toString().trim();

        patrolFeedbackBean.setBright(bright);
        patrolFeedbackBean.setCable(cable);
        patrolFeedbackBean.setCurrent(current);

        patrolFeedbackBean.setEnvironmentImgUrlList(environmentImgUrlList);

        if (null != patrolOrderBean)
            patrolFeedbackBean.setId(patrolOrderBean.getId());

//        if (null != mediaBean)
//            patrolFeedbackBean.setItemId(mediaBean.getId());

//        if (null != mediaBean)
//            patrolFeedbackBean.setItemId(mediaBean.getNumber());

        if (null != mediaBean)
            patrolFeedbackBean.setItemId(mediaBean.getId());

        patrolFeedbackBean.setLiftSystem(liftSystem);

        String light = edt_guangyuan.getText().toString().trim();
        patrolFeedbackBean.setLight(light);

        patrolFeedbackBean.setMajorStructure(majorStructure);
        patrolFeedbackBean.setOn_off(edt_kaiguan.getText().toString().trim());

        patrolFeedbackBean.setMajorImgUrlList(majorImgUrlList);
        patrolFeedbackBean.setOutline(outline);
        patrolFeedbackBean.setPicture(picture);
        patrolFeedbackBean.setPort(edt_duanzi.getText().toString().trim());

        patrolFeedbackBean.setPower(edt_gdianyuan.getText().toString().trim());
        patrolFeedbackBean.setPreserveList(preserveList);
        patrolFeedbackBean.setPulley(pulley);

        patrolFeedbackBean.setSafeLock(safeLock);
        patrolFeedbackBean.setTemperature(edt_biaomianwendu.getText().toString().trim());

        patrolFeedbackBean.setOrderType(CommonEnum.EngineeringORderCategory.PATROL);
        patrolFeedbackBean.setUseEnvironment(useEnvironment);

        patrolFeedbackBean.setVoltage(edt_zongdianya.getText().toString().trim());
        patrolFeedbackBean.setWaterProofEnvironment(waterProofEnvironment);


        return patrolFeedbackBean;
    }

    @Override
    public void ptrolFeedBackSuccessed() {
        Toast.makeText(this, "反馈成功", Toast.LENGTH_SHORT).show();
        EventBus.getDefault().post(new EngineeringOrderDetailForTeamEvent());
//        Intent mIntent = new Intent();
//        setResult(ConstantUtil.START_ACTIVITY_KEY_1, mIntent);
        finish();
    }

    @Override
    public void ptrolFeedBackFailed(String desc) {
        Toast.makeText(this, desc, Toast.LENGTH_SHORT).show();
    }

    @Override
    public String getFilePath() {
        return filePath;
    }

    @Override
    public void upLoadPhotoSuccessed(String uri) {
        if(current_gridvew_module == GRIDVIEW_MODULE_ENVIROMENT){
            environmentImgUrlList.add(uri);
        }else if(current_gridvew_module == GRIDVIEW_MODULE_MAJOR){
            majorImgUrlList.add(uri);
        }


    }

    @Override
    public void upLoadPhotoFailed(String desc) {
        Toast.makeText(this, desc, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }


}


